using System;
using TagTool.Core;

namespace TagTool.Nodes.Math
{
    public class Equals : BaseNode
    {
        private InputSlot slotA;
        private InputSlot slotB;
        private OutputSlot slotC;

        public Equals()
            : base()
        {
            Name = "Equals";
            slotA = new InputSlot(this, "A", 0.0);
            slotB = new InputSlot(this, "B", 0.0);
            slotC = new OutputSlot(this, "Result", typeof(bool));
            slotA.ParseCallback = ParseHelper.ParseDouble;
            slotB.ParseCallback = ParseHelper.ParseDouble;
            slotC.Value = true;
        }

        [NodeAttribute(SlotType.Input, Show = true)]
        public InputSlot SlotA
        {
            get { return slotA; }
        }

        [NodeAttribute(SlotType.Input, Show = true)]
        public InputSlot SlotB
        {
            get { return slotB; }
        }

        [NodeAttribute(SlotType.Output, Show = true)]
        public OutputSlot SlotC
        {
            get { return slotC; }
        }

        public override void Update()
        {
            slotC.Value = (double)slotA.Value == (double)slotB.Value;
        }

    }
}
